package com.example.leetdemo.process;

import java.util.ArrayList;
import java.util.List;

public class Solution57 {

    public int[][] insert(int[][] intervals, int[] newInterval) {
        List<int[]> list = new ArrayList<>();
        int[] temp = null;
        boolean isAdd = false;
        for (int i = 0; i < intervals.length; i++) {
            if (temp == null){
                temp = intervals[i];
            }
            if (isAdd) {
                list.add(temp);
                temp = null;
            } else if (temp[0] > newInterval[1]) {
                list.add(newInterval);
                isAdd = true;
            }
        }
        return null;
    }
}
